
DEFINE VARIABLE hDoc AS HANDLE.
DEFINE VARIABLE hRoot AS HANDLE.
DEFINE VARIABLE hTable AS HANDLE.
DEFINE VARIABLE hField AS HANDLE.
DEFINE VARIABLE hText AS HANDLE.
DEFINE VARIABLE hBuf AS HANDLE.
DEFINE VARIABLE hDBFld AS HANDLE.
DEFINE VARIABLE hTemp1 AS HANDLE.
DEFINE VARIABLE hTemp2 AS HANDLE.

DEFINE VARIABLE i AS INTEGER.
DEFINE VARIABLE j AS INTEGER.

DEFINE VARIABLE k AS INTEGER.
DEFINE VARIABLE l AS INTEGER.

DEFINE VARIABLE custname AS CHARACTER.
DEFINE VARIABLE custnum AS INTEGER.

CREATE X-DOCUMENT hDoc.
CREATE X-NODEREF hRoot.

CREATE X-NODEREF hTemp1.
CREATE X-NODEREF hTemp2.

CREATE X-NODEREF hTable.
CREATE X-NODEREF hField. 
CREATE X-NODEREF hText.

/*read in the file created in the last example*/

hDoc:LOAD("file", "c:\qadguicli\cust.xml", FALSE).
/*
hDoc:LOAD("file", "c:\sample\newcust.xml", FALSE).
*/
hDoc:GET-DOCUMENT-ELEMENT(hRoot).

REPEAT k = 1 TO hRoot:NUM-CHILDREN :

    hRoot:GET-CHILD(hTemp1,k).

    IF hTemp1:NUM-CHILDREN < 1 THEN NEXT.

    REPEAT l = 1 TO  hTemp1:NUM-CHILDREN :

        hTemp1:GET-CHILD(hTemp2,l).
    
        IF hTemp2:NUM-CHILDREN < 1 THEN NEXT.

        REPEAT i = 1 TO  hTemp2:NUM-CHILDREN :
    
            hTemp2:GET-CHILD(hTable,i).
    
            IF hTable:NUM-CHILDREN < 1 THEN NEXT.
    
            REPEAT j = 1 TO hTable:NUM-CHILDREN:
    
                hTable:GET-CHILD(hField,j).
    
                IF hField:NUM-CHILDREN < 1 THEN NEXT.
    
                hField:GET-CHILD(hText,1).
                
                /*
                DISP custname custnum hField:NAME hTEXT:NODE-VALUE FORMAT "x(40)" WITH FRAME a DOWN.
                */
                DISP hField:NAME hText:NODE-VALUE FORMAT "x(80)" NO-ERROR.

            END.
        END.
    END.

END.
